package com.zsrt.java.day20161226.lh.homework161226.demo03.Demo10;

import static org.junit.Assert.*;

import java.util.Scanner;

import org.junit.Test;

public class table99 {
	
	
	/**
	 * 用while打印99乘法表
	 * 
	 * @throws Exception
	 */
	@Test
	public void testName() throws Exception {
		//从键盘输入数
		Scanner sc=new Scanner(System.in);
		System.out.println("输入乘数：");
		int a=sc.nextInt();
		System.out.println("输入乘数：");
		int b=sc.nextInt();
		sc.close();
		
		tablexy(a,b);
		
	}

	/**
	 * while方法
	 * 
	 * @param a 列
	 * @param b 行
	 */
	private void tablexy(int a,int b) {
		
		int begin=a;
		int end=b;
		//行
		while(begin<=end){
			int i=1;
			//列
			while(i<=begin){
				System.out.print(begin+"*"+i+"="+(begin*i)+"\t");
				//步长
				i++;
			}
			//步长
			begin++;
			System.out.println();
		}
	}
	
	
	
	
	@Test
	public void testName02() throws Exception {
		//从键盘输入数
		Scanner sc=new Scanner(System.in);
		System.out.println("输入乘数：");
		int x=sc.nextInt();
		System.out.println("输入乘数：");
		int y=sc.nextInt();
		sc.close();
		xytable(x,y);
	}


	/**
	 * 
	 * 
	 * @param a 列
	 * @param b 行
	 */
	private void xytable(int a,int b) {
		int begin=a;
		int end=b;
		//行
		do{
			int i=1;
			//列
			do{
				System.out.print(begin+"*"+i+"="+(begin*i)+"\t");
				//步长
				i++;
			}while(i<begin);
				
			//步长
			begin++;
			System.out.println();
		}while(begin<=end);
	}

}


